home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
351-375
/
disk_352
/
mg
/
src.lzh
/
h
/
line.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-23
|
2KB
|
54 lines
#ifndef LINE_H
#define LINE_H
/*
* All text is kept in circularly linked lists of "LINE" structures. These
* begin at the header line (which is the blank line beyond the end of the
* buffer). This line is pointed to by the "BUFFER". Each line contains a the
* number of bytes in the line (the "used" size), the size of the text array,
* and the text. The end of line is not stored as a byte; it's implied.
* Future additions will include update hints, and a list of marks into the
* line.
*/
struct line {
struct line *l_fp; /* Link to the next line */
struct line *l_bp; /* Link to the previous line */
short l_size; /* Allocated size */
short l_used; /* Used size */
#ifndef ZEROARRAY
char l_text[1]; /* A bunch of characters. */
#else
char l_text[]; /* A bunch of characters. */
#endif
};
/*
* The rationale behind these macros is that you could (with some editing,
* like changing the type of a line link from a "LINE *" to a "REFLINE", and
* fixing the commands like file reading that break the rules) change the
* actual storage representation of lines to use something fancy on machines
* with small address spaces.
*/
#define lforw(lp) ((lp)->l_fp)
#define lback(lp) ((lp)->l_bp)
#define lgetc(lp, n) (CHARMASK((lp)->l_text[(n)]))
#define lputc(lp, n, c) ((lp)->l_text[(n)]=(c))
#define llength(lp) ((lp)->l_used)
#define ltext(lp) ((lp)->l_text)
/*
* line externals.
*/
extern struct line *lalloc();
extern struct line *lallocx();
#ifndef NO_PROTO
struct line *lalloc(int used);
struct line *lallocx(int used);
void lfree(struct line * lp);
int getgoal(struct line * dlp);
/* Define things that need the line structure */
int d_makename PROTO((struct line *, char *));
#endif
#endif